<!DOCTYPE html>
<html>
 <head> 
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
  <title> SSE 消息推送 </title> 
 </head> 
 <body> 
 <div id="info">SSE<br/></div> 
  <script type="text/javascript">
    var source = new EventSource("/sse");
    source.onopen = function (event) {
        console.log("connected")
    };
    source.onmessage = function (event) {
        m = document.getElementById("info")
        m.innerHTML += event.data + "<br/>"
    };
    source.addEventListener("close", function(event) {
        console.log("closed")
        source.close()
    }, false);
    </script>
 </body>
</html>
